// HSS.Forms.MainModuleBase.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       MainModuleBase.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Forms
{
	#region Using Directives
	using System;
	using System.ComponentModel;
	using System.Windows.Forms;

	using HSS.Data;
	#endregion

	#region MainModuleBase
	/// <summary>
	/// Summary description for FormDetailImpl.
	/// </summary>
	[ToolboxItem(false)]
	public partial class MainModuleBase : ModuleBase
    {
        #region Constructor
        /// <summary>
		/// ctor
		/// </summary>
		public MainModuleBase()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
        }
        #endregion

        #region Properties

        #region Appearance
        /// <summary>
        /// The Borderstyle of the Container Form.
        /// </summary>
        [Description("The FormBorderStyle of the Container Form.")]
        [CategoryAttribute("Appearance")]
        public FormBorderStyle ParentBorderStyle
        {
            get
            {
                return _parentBorderStyle;
            }
            set
            {
                _parentBorderStyle = value;
            }
        } FormBorderStyle _parentBorderStyle = FormBorderStyle.Sizable;
		
		#endregion

		#region Display
		/// <summary>
		/// The Title or Overview for this Module
		/// </summary>
		[Description("The Title or Overview for this Module")]
		[Category("Display")]
		public string					ModuleTitle
		{
			get { return _ModuleTitle; }
			set { _ModuleTitle = value; }
		} string _ModuleTitle = string.Empty;
		/// <summary>
		/// The description or action for this Module
		/// </summary>
		[Description("The description or action for this child Module")]
		[Category("Display")]
		public string					ActionDescription
		{
			get { return _actionDescription; }
			set { _actionDescription = value; }
		} string _actionDescription = string.Empty;
		/// <summary>
		/// The Image to display for the Module
		/// </summary>
		[Description("The Image to display for the module.")]
		[CategoryAttribute("Display")]
		[DefaultValue(null)]
		public System.Drawing.Image Image
		{
			get { return _image; }
			set { _image = value; }
		} System.Drawing.Image _image = null;
		#endregion

		#region Layout
		/// <summary>
		/// Indicates whether or not to show the Header Area
		/// </summary>
		[Description("Indicates whether or not to show the Header Area.")]
		[CategoryAttribute("Layout")]
		[DefaultValue(true)]
		public bool HeaderVisible
		{
			get { return _headerVisible; }
			set { _headerVisible = value; }
		} bool _headerVisible = true;
		/// <summary>
		/// Indicates the desired height of the Header Area
		/// </summary>
		[Description("Indicates the desired height of the Header Area.")]
		[CategoryAttribute("Layout")]
		[DefaultValue(70)]
		public int HeaderHeight
		{
			get { return _headerHeight; }
			set { _headerHeight = value; }
		} int _headerHeight = 70;
		/// <summary>
		/// Specifies the initial position of the Parent Form.
		/// </summary>
		[Description("Specifies the initial position of the Parent Form.")]
		[CategoryAttribute("Layout")]
		[DefaultValue(true)]
		public FormStartPosition ParentStartPosition
		{
			get { return _parentStartPosition; }
			set { _parentStartPosition = value; }
		} FormStartPosition _parentStartPosition = FormStartPosition.CenterParent;	
		#endregion

		#region Window Style
		/// <summary>
		/// The Icon to display for the Module's Parent Form
		/// </summary>
		[Description("The Icon to display for the Module's Parent Form.")]
		[CategoryAttribute("Window Style")]
		[DefaultValue(null)]
		public System.Drawing.Icon ParentIcon
		{
			get { return _parentIcon; }
			set { _parentIcon = value; }
		} System.Drawing.Icon _parentIcon = null;
		/// <summary>
		/// Should the Container Form show the Maximize Box.
		/// </summary>
		[Description("Should the Container Form show the Maximize Box.")]
		[CategoryAttribute("Window Style")]
		public bool						MaximizeBox
		{
			get
			{
				return _containerMaximize;
			}
			set
			{
				_containerMaximize = value;
			}
		} bool _containerMaximize = true;
		/// <summary>
		/// Should the Container Form show the Minimize Box.
		/// </summary>
		[Description("Should the Container Form show the Minimize Box.")]
		[CategoryAttribute("Window Style")]
		public bool						MinimizeBox
		{
			get
			{
				return _containerMinimize;
			}
			set
			{
				_containerMinimize = value;
			}
		} bool _containerMinimize = true;
		/// <summary>
		/// Should the Container Form be shown in the TaskBar.
		/// </summary>
		[Description("Should the Container Form be shown in the TaskBar.")]
		[CategoryAttribute("Window Style")]
		public bool						ShowInTaskbar
		{
			get
			{
				return _showInTaskBar;
			}
			set
			{
				_showInTaskBar = value;
			}
		} bool _showInTaskBar = true;
		
		#endregion

		#region MainMenu
		/// <summary>
		/// The Main Menu for the Parent Form to use.
		/// </summary>
		[Browsable(false)]
		public MenuStrip MenuSystem
		{
			get { return _menuSystem; }
			set { _menuSystem = value; }
		} MenuStrip _menuSystem;
		#endregion

        #region Nonbrowseable
        /// <summary>
        /// Indicates if this formhas been loaded
        /// </summary>
        [Description("Indicates if this form has been loaded.")]
        [Browsable(false)]
        [DefaultValue(false)]
        public bool Loaded
        {
            get { return _loaded; }
            set { _loaded = value; }
        } bool _loaded;
        /// <summary>
        /// Indicates if this form is currently loading
        /// </summary>
        [Description("Indicates if this form is currently loading.")]
        [Browsable(false)]
        [DefaultValue(false)]
        public bool Loading
        {
            get { return _loading; }
            set { _loading = value; }
        } bool _loading;
        /// <summary>
        /// Indicates if this form is the main Application Form
        /// </summary>
        [Description("Indicates if this form is the main Application Form.")]
        [Browsable(false)]
        [DefaultValue(false)]
        public bool IsMainForm
        {
            get { return _isMainForm; }
            set { _isMainForm = value; }
        } bool _isMainForm;

        #endregion

        #endregion

        #region Methods
        /// <summary>
        /// Virtual Method for the initializign the module
        /// </summary>
        /// <param name="data">Any data to be provided for the initial load</param>
        public virtual bool InitializeModule(IDataContainer[] data) { return true; }
        /// <summary>
		/// Gets the data contained in this Module
		/// </summary>
		/// <returns>An array of IDataContainer type</returns>
		public virtual IDataContainer[] GetData(){return null;}
		/// <summary>
        /// Set Module to a Dirty State
        /// </summary>
        protected virtual void SetDirty()
        {
            this.SetDirty(true);
        }
        /// <summary>
        /// Set Module to a Dirty State
        /// </summary>
        /// <param name="isEditing">Indicates user has begun editing fields</param>
        protected virtual void SetDirty(bool isEditing)
        {
            this.SetDirty(false, isEditing, null);
        }
        /// <summary>
        /// Set Module to a Dirty State
        /// </summary>
        /// <param name="ForceDirty">Force setting Module to dirty and raise event.</param>
        /// <param name="IsEditing">Indicates user has begun editing fields</param>
        protected virtual void SetDirty(bool ForceDirty, bool IsEditing)
        {
            this.SetDirty(ForceDirty, IsEditing, null);
        }
        /// <summary>
        /// Set Module to a Dirty State
        /// </summary>
        /// <param name="ForceDirty">Force setting Module to dirty and raise event.</param>
        /// <param name="IsEditing">Indicates user has begun editing fields</param>
        /// <param name="State">State object</param>
        protected virtual void SetDirty(bool ForceDirty, bool IsEditing, object State)
        {
            if (!this.IsDirty | ForceDirty)
				this.IsDirty = true;
			InvokeDirty(this, new DirtyEventArgs(this.IsDirty, IsEditing, State));
		}
        /// <summary>
        /// Set Modules Dirty State
        /// </summary>
        /// <param name="IsDirty">Indicates if form is dirty</param>
        /// <param name="State">State object</param>
        protected virtual void SetDirty(bool IsDirty, object State)
        {
            this.IsDirty = IsDirty;
			InvokeDirty(this, new DirtyEventArgs(IsDirty, true, State));
		}
		#endregion
    }	
	#endregion
}